From 770725fbdcc8ea7bf47ef0af5a43a239bef98ff6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 16 Aug 2022 15:31:41 -0700 Subject: sveltekit route migration --- src/routes/invoice/[id]/+page.server.js | 14 ++ src/routes/invoice/[id]/+page.svelte | 351 ++++++++++++++++++++++++++++++++ 2 files changed, 365 insertions(+) create mode 100644 src/routes/invoice/[id]/+page.server.js create mode 100644 src/routes/invoice/[id]/+page.svelte (limited to 'src/routes/invoice/[id]') diff --git a/src/routes/invoice/[id]/+page.server.js b/src/routes/invoice/[id]/+page.server.js new file mode 100644 index 00000000..78607545 --- /dev/null +++ b/src/routes/invoice/[id]/+page.server.js @@ -0,0 +1,14 @@ +import { get } from '$lib/utils'; + +export async function load({ params }) { + let { id } = params; + let { + amount, + rate, + status, + text, + user: { username } + } = await get(`/invoice?uuid=${id}`); + + return { amount, id, rate, username, status, text }; +} diff --git a/src/routes/invoice/[id]/+page.svelte b/src/routes/invoice/[id]/+page.svelte new file mode 100644 index 00000000..0252a6b1 --- /dev/null +++ b/src/routes/invoice/[id]/+page.svelte @@ -0,0 +1,351 @@ + + +{#if $invoices[id]?.status !== 'paid'} +
+ + +
+
+ +
+

Add a tip?

+ +
+ {tipAmountFormatted}{`(${tipAmountSats} SATS)`} + {tipPercent}% +
+ + { + customTipAmount = ''; + customInput.value = ''; + tipPercent = e.target.value; + }} + /> + +
+ {#each tipAmounts as amount} + + {/each} + +
+ $ + handleCustomTipAmount(e)} + class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" + placeholder="Other" + /> + +
+
+
+ + +
+{:else} +
+ +

Payment Successful!

+

+ {totalAmountFormatted} + {$preferredCurrency} +

+

({totalAmountSats} SATS)

+ +
+{/if} + + -- cgit v1.2.3